//
//  HSImageDownloader.h
//  AFNetworking
//
//  Created by huang on 2018/8/21.
//

#import <Foundation/Foundation.h>

typedef void(^DownLoadSuccessBlock)(UIImage *image);
typedef void(^DownLoadFailureBlock)(void);

@interface HSImageDownloader : NSObject

/**
 纯色的图片 lightGrayColor
 
 @return 占位图片
 */
+ (UIImage *)placeholderImage;

/**
 *  下载图片
 *
 *  @param urlStr    图片链接地址
 *  @param place     占位图片
 *  @param imageView 图片视图
 */
+ (void)downloadImage:(NSString *)urlStr place:(UIImage *)place imageView:(UIImageView *)imageView;

/**
 *  下载图片
 *
 *  @param urlStr    图片链接地址
 *  @param place     占位图片
 *  @param imageView 图片视图
 *  @param success   成功回调
 *  @param failure   失败回调
 */
+ (void)downloadImage:(NSString *)urlStr place:(UIImage *)place imageView:(UIImageView *)imageView success:(DownLoadSuccessBlock)success failure:(DownLoadFailureBlock)failure;

/**
 *  下载图片
 *
 *  @param url    图片链接
 *  @param button 按钮
 *  @param state  按钮状态
 */
+ (void)downloadImageWithURL:(NSURL *)url button:(UIButton *)button forState:(UIControlState)state;


@end

@interface UIImage (DD)


/**
 根据颜色值生成图片
 
 @param color color
 @param cornerRadius cornerRadius
 @return UIImage
 */
+ (UIImage *)imageWithColor:(UIColor *)color cornerRadius:(CGFloat)cornerRadius;

@end
